﻿import QtQuick 2.15
import QtQuick.Controls 2.15

Item {
    width: screenWidth
    height: screenHeight

    Item{
        id:backGround
        anchors.fill: parent
    }

    property real textPixsize: 30       // 字号
    property real selectIndex: -1       // 当前选中项


    property string load_knife
    property string load_roller
    property string load_stress01
    property string load_stress02
    property string load_stress03
    property string load_f_knife01
    property string load_f_knife02
    property string load_f_knife03
    property string load_b_knife01
    property string load_b_knife02
    property string load_b_knife03

    Rectangle{
        id:formulaBack
        anchors.top: backGround.top
        anchors.topMargin: 200
        anchors.left: backGround.left
        anchors.leftMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 1060
        height: 1400
        clip: true


        ScrollBar{
            id:vbar
            z:10
            width: 30
            height: 100
            hoverEnabled: true
            active: hovered || pressed
            orientation: Qt.Vertical
            size: formulaBack.height / formulaListShow.height
            // snapMode: ScrollBar.SnapAlways
            policy: ScrollBar.AlwaysOn
            anchors.top: parent.top
            anchors.topMargin: 80
            anchors.right: parent.right
            anchors.bottom: parent.bottom
        }
        ScrollBar{
            id:hbar
            z:10
            width: 100
            height: 30
            hoverEnabled: true
            active: hovered || pressed
            orientation: Qt.Horizontal
            size: formulaBack.width / formulaListShow.width
            // snapMode: ScrollBar.SnapAlways
            policy: ScrollBar.AlwaysOn
            anchors.left: parent.left
            anchors.right: parent.right
            anchors.bottom: parent.bottom
        }

        Row{        // 列表标题
            z:10
            x: (-hbar.position * width)
            Repeater{
                model:14
                Rectangle{
                    width: index === 1 ? 150 : index === 2 ? 150 : 110
                    height: 80
                    border.width: 1
                    border.color: "white"
                    color: "black"

                    Text{
                        font.pixelSize: 30
                        anchors.centerIn: parent
                        color:"white"
                        text: index === 0 ? "序号" :
                                index === 1 ? "型材名称" :
                                index === 2 ? "型材编号" :
                                index === 3 ? "刀盘" :
                                index === 4 ? "胶辊" :
                                index === 5 ? "压力1" :
                                index === 6 ? "压力2" :
                                index === 7 ? "压力3" :
                                index === 8 ? "前刀1" :
                                index === 9 ? "前刀2" :
                                index === 10 ? "前刀3":
                                index === 11 ? "后刀1":
                                index === 12 ? "后刀2":
                                                "后刀3"
                    }
                }
            }
        }


        ListView{       // 表格显示
            id:formulaListShow
            width: 1620
            height:  Cpp_ItemModel.count() * 80
            y: 80 + (-vbar.position * height)
            x: (-hbar.position * width)
            highlight: Rectangle{color:"lightblue"}

            model:Cpp_ItemModel

            delegate:contactDelegate

        }

        Component {
            id: contactDelegate
            Rectangle{
                id:oneListRect
                width: 1620
                height: 80
                // y:150
                color:ListView.isCurrentItem  ?"gold":"#FFFFFF"
                MouseArea{
                    anchors.fill: parent
                    propagateComposedEvents: true
                    onClicked: {
                        formulaListShow.currentIndex  =index;
                        selectIndex =index
                        // console.log(index)
                        console.log(matterNameText.text+" | "+matterNumberText.text+" | "+
                                    knifeText.text +" | "+rollerText.text+" | "+
                                    stress01Text.text+" | "+stress02Text.text+" | "+stress03Text.text+" | "+
                                    f_Knife01Text.text+" | "+f_Knife02Text.text+" | "+f_Knife03Text.text+" | "+
                                    b_Knife01Text.text+" | "+b_Knife02Text.text+" | "+b_Knife03Text.text)
                        load_knife = knifeText.text
                        load_roller = rollerText.text
                        load_stress01 = stress01Text.text
                        load_stress02 = stress02Text.text
                        load_stress03 = stress03Text.text
                        load_f_knife01 = f_Knife01Text.text
                        load_f_knife02 = f_Knife02Text.text
                        load_f_knife03 = f_Knife03Text.text
                        load_b_knife01 = b_Knife01Text.text
                        load_b_knife02 = b_Knife02Text.text
                        load_b_knife03 = b_Knife03Text.text
                    }
                }

                Rectangle{      // 序号
                    id:orderNumber
                    width: 110
                    height: 80
                    color: "transparent"
                    border.width: 1

                    Text{
                        font.pixelSize: textPixsize
                        anchors.centerIn: parent
                        text: (index + 1)
                    }
                }

                Rectangle{          // 型材名称
                    id:matterNameItem
                    width: 150;height: 80
                    anchors{
                        left: orderNumber.right
                        top:parent.top
                    }

                    border.width: 1
                    clip:true
                    color: "transparent"
                    Text {          // 型材名称
                        id: matterNameText
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        verticalAlignment: Text.AlignVCenter
                        horizontalAlignment: Text.horizontalAlignment
                        text:Name//qsTr("型材名称")
                    }
                    TextInput {
                        id: matterNameTextInput
                        anchors{
                            centerIn: parent
                        }
                        maximumLength: 8
                        selectByMouse: true
                        verticalAlignment: Text.AlignVCenter
                        horizontalAlignment: Text.horizontalAlignment
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:matterNameText.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见

                        onEditingFinished: {
                            matterNameText.text = matterNameTextInput.text // 当编辑完成时，更新 Text 控件的文本
                            matterNameTextInput.visible = false
                            matterNameText.visible=true
                            console.log("selectIndex:",selectIndex)
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Name",matterNameText.text)

                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            mouse.accepted=false
                            matterNameText.visible = false
                            matterNameTextInput.visible = true
                            matterNameTextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{          // 型材编号
                    id:matterNumberItem
                    width: 150;height: 80
                    anchors{
                        left: matterNameItem.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: matterNumberText
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text:Number// qsTr("型材编号")
                    }
                    TextInput {
                        id: matterNumberTextInput
                        anchors{
                            centerIn: parent
                        }
                        verticalAlignment: Text.AlignVCenter
                        maximumLength: 8
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:matterNumberText.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        onEditingFinished: {
                            matterNumberText.text = matterNumberTextInput.text // 当编辑完成时，更新 Text 控件的文本
                            matterNumberTextInput.visible = false
                            matterNumberText.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Number",matterNumberText.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            matterNumberText.visible = false
                            matterNumberTextInput.visible = true
                            matterNumberTextInput.forceActiveFocus();
                        }
                    }
                }
                Rectangle{          // 刀盘
                    id:knifeItem
                    width: 110;height: 80
                    anchors{
                        left: matterNumberItem.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: knifeText
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: Knife//qsTr("刀盘")
                    }
                    TextInput {
                        id: knifeTextInput
                        anchors{
                            centerIn: parent
                        }
                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        maximumLength: 6
                        text:knifeText.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        onEditingFinished: {
                            knifeText.text = knifeTextInput.text // 当编辑完成时，更新 Text 控件的文本
                            knifeTextInput.visible = false
                            knifeText.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Knife",knifeText.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            knifeText.visible = false
                            knifeTextInput.visible = true
                            knifeTextInput.forceActiveFocus();
                        }
                    }
                }
                Rectangle{          // 胶辊
                    id:rollerItem
                    width: 110
                    height: 80
                    anchors{
                        left: knifeItem.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: rollerText
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text:Roller// qsTr("胶棒")
                    }
                    TextInput {
                        id: rollerTextInput
                        anchors{
                            centerIn: parent
                        }
                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        maximumLength: 6
                        text:rollerText.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        onEditingFinished: {
                            rollerText.text = rollerTextInput.text // 当编辑完成时，更新 Text 控件的文本
                            rollerTextInput.visible = false
                            rollerText.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Roller",rollerText.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            rollerText.visible = false
                            rollerTextInput.visible = true
                            rollerTextInput.forceActiveFocus();
                        }
                    }
                }
                Rectangle{              // 压力1
                    id:stress01Item
                    width: 110
                    height: 80
                    anchors{
                        left: rollerItem.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: stress01Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: Stress01//qsTr("压力1")
                    }
                    TextInput {
                        id: stress01TextInput
                        anchors{
                            centerIn: parent
                        }
                        verticalAlignment: Text.AlignVCenter
                        // horizontalAlignment: Text.horizontalAlignment
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:stress01Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 6
                        onEditingFinished: {
                            stress01Text.text = stress01TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            stress01TextInput.visible = false
                            stress01Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Stress01",stress01Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            stress01Text.visible = false
                            stress01TextInput.visible = true
                            stress01TextInput.forceActiveFocus();
                        }
                    }
                }
                Rectangle{          // 压力2
                    id:stress02Item
                    width: 110
                    height: 80
                    anchors{
                        left: stress01Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: stress02Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text:  Stress02//qsTr("压力2")
                    }
                    TextInput {
                        id: stress02TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:stress02Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 6
                        onEditingFinished: {
                            stress02Text.text = stress02TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            stress02TextInput.visible = false
                            stress02Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Stress02",stress02Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            stress02Text.visible = false
                            stress02TextInput.visible = true
                            stress02TextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{              // 压力3
                    id:stress03Item

                    width: 110
                    height: 80
                    anchors{
                        left: stress02Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: stress03Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize;
                        text: Stress03//qsTr("压力3")
                    }
                    TextInput {
                        id: stress03TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:stress03Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见

                        onEditingFinished: {
                            stress03Text.text = stress03TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            stress03TextInput.visible = false
                            stress03Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"Stress03",stress03Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            stress03Text.visible = false
                            stress03TextInput.visible = true
                            stress03TextInput.forceActiveFocus();
                        }
                    }
                }
                Rectangle{          // 前刀1
                    id:f_Knife01Item

                    width: 110
                    height: 80
                    anchors{
                        left: stress03Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: f_Knife01Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: F_Knife01//qsTr("前刀1")
                    }
                    TextInput {
                        id: f_Knife01TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:f_Knife01Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见

                        onEditingFinished: {
                            f_Knife01Text.text = f_Knife01TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            f_Knife01TextInput.visible = false
                            f_Knife01Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"F_Knife01",f_Knife01Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            f_Knife01Text.visible = false
                            f_Knife01TextInput.visible = true
                            f_Knife01TextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{              // 前刀2
                    id:f_Knife02Item

                    width: 110
                    height: 80
                    anchors{
                        left: f_Knife01Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: f_Knife02Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: F_Knife02//qsTr("前刀2")
                    }
                    TextInput {
                        id: f_Knife02TextInput
                        anchors{
                            centerIn: parent
                        }
                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:f_Knife02Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 6
                        onEditingFinished: {
                            f_Knife02Text.text = f_Knife02TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            f_Knife02TextInput.visible = false
                            f_Knife02Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"F_Knife02",f_Knife02Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            f_Knife02Text.visible = false
                            f_Knife02TextInput.visible = true
                            f_Knife02TextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{              // 前刀3
                    id:f_Knife03Item

                    width: 110
                    height: 80
                    anchors{
                        left: f_Knife02Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: f_Knife03Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: F_Knife03//("前刀3")
                    }
                    TextInput {
                        id: f_Knife03TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:f_Knife03Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 8
                        onEditingFinished: {
                            f_Knife03Text.text = f_Knife03TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            f_Knife03TextInput.visible = false
                            f_Knife03Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"F_Knife03",f_Knife03Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            f_Knife03Text.visible = false
                            f_Knife03TextInput.visible = true
                            f_Knife03TextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{
                    id:b_Knife01Item
                    width: 110
                    height: 80
                    anchors{
                        left: f_Knife03Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: b_Knife01Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: B_Knife01//qsTr("后刀1")
                    }
                    TextInput {
                        id: b_Knife01TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:b_Knife01Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 6
                        onEditingFinished: {
                            b_Knife01Text.text = b_Knife01TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            b_Knife01TextInput.visible = false
                            b_Knife01Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"B_Knife01",b_Knife01Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            b_Knife01Text.visible = false
                            b_Knife01TextInput.visible = true
                            b_Knife01TextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{
                    id:b_Knife02Item

                    width: 110
                    height: 80
                    anchors{
                        left: b_Knife01Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: b_Knife02Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text:B_Knife02// qsTr("后刀2")
                    }
                    TextInput {
                        id: b_Knife02TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:b_Knife02Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 6
                        onEditingFinished: {
                            b_Knife02Text.text = b_Knife02TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            b_Knife02TextInput.visible = false
                            b_Knife02Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"B_Knife02",b_Knife02Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            b_Knife02Text.visible = false
                            b_Knife02TextInput.visible = true
                            b_Knife02TextInput.forceActiveFocus();
                        }
                    }
                }

                Rectangle{
                    id:b_Knife03Item

                    width:110
                    height: 80
                    anchors{
                        left: b_Knife02Item.right
                        top:parent.top
                    }
                    border.width: 1
                    color: "transparent"
                    Text {
                        id: b_Knife03Text
                        anchors{
                            centerIn: parent
                        }
                        font.pixelSize:textPixsize
                        text: B_Knife03//qsTr("后刀3")
                    }
                    TextInput {
                        id: b_Knife03TextInput
                        anchors{
                            centerIn: parent
                        }

                        verticalAlignment: Text.AlignVCenter
                        font.pixelSize: textPixsize
                        cursorVisible: true
                        text:b_Knife03Text.text // 同步 Text 和 TextInput 的文本
                        visible: false // 使 TextInput 默认不可见
                        maximumLength: 6
                        onEditingFinished: {
                            b_Knife03Text.text = b_Knife03TextInput.text // 当编辑完成时，更新 Text 控件的文本
                            b_Knife03TextInput.visible = false
                            b_Knife03Text.visible=true
                            Cpp_Qmlengine.qmlSaveData(selectIndex,"B_Knife03",b_Knife03Text.text)
                        }
                    }
                    MouseArea {
                        anchors.fill: parent
                        acceptedButtons: Qt.LeftButton
                        propagateComposedEvents: true
                        onDoubleClicked: {
                            b_Knife03Text.visible = false
                            b_Knife03TextInput.visible = true
                            b_Knife03TextInput.forceActiveFocus();
                        }
                    }
                }
            }
        }
    }

    Rectangle{
        anchors.top: backGround.top
        anchors.topMargin: 1610
        anchors.left: backGround.left
        anchors.leftMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 700
        height: 100

        Text{
            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
            anchors.leftMargin: 10
            text:"搜索配方"
            font.pixelSize: 30
            font.bold: true
            color: "white"
        }

        Rectangle{
            width: 300
            height: 80
            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
            anchors.leftMargin: 170
            color: "#00adfb"
            radius: 10
            border.width: 1
            border.color: "#008edd"

            TextInput{
                id:searchInput
                anchors.centerIn: parent
                font.pixelSize: 40
                font.bold: true
                visible: true
                color: "white"
                selectByMouse: true
                maximumLength: 12
                horizontalAlignment: Text.horizontalAlignment
                onAccepted: {
                    // console.log("搜索事件触发 - 搜索："+text)
                    Cpp_Qmlengine.qmlSearchData(text)
                }
            }

            MouseArea{
                anchors.fill: parent
                onClicked: {
                    searchInput.forceActiveFocus()
                }
            }
        }

        Rectangle{
            width: 200
            height: 80
            anchors.verticalCenter: parent.verticalCenter
            anchors.right: parent.right
            anchors.rightMargin: 10
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"加载配方参数"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Connect.AutomaticPanel_OneKeyWriteParameter(load_knife,
                                                                    load_roller,
                                                                    load_stress01,
                                                                    load_stress02,
                                                                    load_stress03,
                                                                    load_f_knife01,
                                                                    load_f_knife02,
                                                                    load_f_knife03,
                                                                    load_b_knife01,
                                                                    load_b_knife02,
                                                                    load_b_knife03)
                }
            }
        }


    }

    Rectangle{
        anchors.top: backGround.top
        anchors.topMargin: 1610
        anchors.right: backGround.right
        anchors.rightMargin: 10
        color: "#0b49b0"
        border.width: 1
        border.color: "#008edd"
        width: 350
        height: 100

        Rectangle{
            width: 160
            height: 80
            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
            anchors.leftMargin: 10
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"添加配方"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"                    
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    formulaListShow.height+=80
                    Cpp_Qmlengine.qmlAddData()
                }
            }
        }

        Rectangle{
            width: 160
            height: 80
            anchors.verticalCenter: parent.verticalCenter
            anchors.right: parent.right
            anchors.rightMargin: 10
            radius: 10
            color: "#2b6ec5"

            Text{
                anchors.centerIn: parent
                font.pixelSize: 30
                font.bold: true
                color: "white"
                text:"删除配方"
            }

            MouseArea{
                anchors.fill: parent

                onPressed: {
                    parent.color = "#e44034"
                }

                onReleased: {
                    parent.color = "#2b6ec5"
                    Cpp_Qmlengine.qmlDeleteDataByIndex(selectIndex)
                }
            }
        }

        // Button{
        //     width: 200
        //     height: 80
        //     x:100
        //     z:100
        //     onClicked: {
        //         // 获取一次当前位置信息
        //         Cpp_Connect.getCurrentLocationOnce()
        //         console.log(Cpp_Connect.knifeCurrLocation ,
        //                     Cpp_Connect.rollerCurrLocation,
        //                     Cpp_Connect.stress01CurrLocation,
        //                     Cpp_Connect.stress02CurrLocation ,
        //                     Cpp_Connect.stress03CurrLocation ,
        //                     Cpp_Connect.f_knife01CurrLocation ,
        //                     Cpp_Connect.f_knife02CurrLocation ,
        //                     Cpp_Connect.f_knife03CurrLocation ,
        //                     Cpp_Connect.b_knife01CurrLocation ,
        //                     Cpp_Connect.b_knife02CurrLocation,
        //                     Cpp_Connect.b_knife03CurrLocation)
        //         formulaListShow.height+=80
        //         Cpp_Qmlengine.updateCurrentLocation(Cpp_Connect.knifeCurrLocation ,
        //                                             Cpp_Connect.rollerCurrLocation,
        //                                             Cpp_Connect.stress01CurrLocation,
        //                                             Cpp_Connect.stress02CurrLocation ,
        //                                             Cpp_Connect.stress03CurrLocation ,
        //                                             Cpp_Connect.f_knife01CurrLocation ,
        //                                             Cpp_Connect.f_knife02CurrLocation ,
        //                                             Cpp_Connect.f_knife03CurrLocation ,
        //                                             Cpp_Connect.b_knife01CurrLocation ,
        //                                             Cpp_Connect.b_knife02CurrLocation,
        //                                             Cpp_Connect.b_knife03CurrLocation)
        //     }
        // }


    }






}
